/*
 * scout_layout.css
 * ----------------
 * Silent Scout — Page-level layout: root variables, body, command bar,
 * two-panel builder layout, viewer grid, and responsive breakpoints.
 *
 * Adheres to the Hex-Reinforced Design System (Design_Idea_1).
 * Dependencies: Google Fonts (Inter, JetBrains Mono) loaded in HTML
 */

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --hex-blue:        #3b82f6;
  --hex-glow:        rgba(59, 130, 246, 0.5);

  --dark-bg:         #0f172a;
  --panel-bg:        rgba(17, 24, 39, 0.7);
  --panel-bg-solid:  #111827;
  --panel-bg-heavy:  rgba(17, 24, 39, 0.92);

  --border-color:    #374151;
  --border-light:    rgba(255, 255, 255, 0.08);

  --text-main:       #f3f4f6;
  --text-muted:      #9ca3af;
  --text-dim:        #6b7280;

  --accent-green:    #10b981;
  --accent-red:      #ef4444;
  --accent-orange:   #f59e0b;
  --accent-purple:   #8b5cf6;
  --accent-cyan:     #06b6d4;

  --cmd-bar-height:  64px;
  --time-bar-height: 52px;
  --sidebar-width:   280px;

  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slide: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--dark-bg);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.08), transparent 50%),
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  overflow: hidden;
}

/* ── Command Bar ────────────────────────────────────────────────────────────── */
.command-bar {
  height: var(--cmd-bar-height);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

.cmd-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cmd-logo {
  width: 42px;
  height: 36px;
  background: rgba(59, 130, 246, 0.2);
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5));
}

.cmd-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-main);
}

.cmd-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cmd-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmd-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── App Shell ──────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Builder Layout: Left Sidebar + Main Canvas ─────────────────────────────── */
.builder-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left sidebar — dashboard config + library */
.builder-sidebar {
  width: var(--sidebar-width);
  background: var(--panel-bg-heavy);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-section:last-child {
  border-bottom: none;
  flex: 1;
}

.sidebar-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* Main canvas — section builder */
.builder-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.canvas-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0.4;
  pointer-events: none;
}

.canvas-empty-icon {
  font-size: 48px;
}

.canvas-empty-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ── Viewer Layout ──────────────────────────────────────────────────────────── */
.viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Time filter bar */
.time-bar {
  height: var(--time-bar-height);
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

/* ── Dashboard Section Row ──────────────────────────────────────────────────── */
.dashboard-section {
  width: 100%;
}

.section-grid {
  display: grid;
  gap: 12px;
  width: 100%;
}

/* Column count variants */
.section-grid[data-cols="1"] { grid-template-columns: 1fr; }
.section-grid[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.section-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.section-grid[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
.section-grid[data-cols="5"] { grid-template-columns: repeat(5, 1fr); }

/* ── Builder Section Card ───────────────────────────────────────────────────── */
.builder-section-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  padding: 0;
}

.builder-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border-light);
}

.builder-section-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.builder-section-controls {
  display: flex;
  gap: 6px;
}

.builder-section-grid {
  display: grid;
  gap: 10px;
  padding: 12px;
}

/* ── Slot Cell ──────────────────────────────────────────────────────────────── */
.slot-cell {
  min-height: 80px;
  background: rgba(255,255,255,0.025);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.slot-cell:hover {
  border-color: var(--hex-blue);
  background: rgba(59, 130, 246, 0.06);
}

.slot-cell.filled {
  border-style: solid;
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.04);
}

.slot-cell.text-slot {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.04);
}

.slot-add-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* ── Viewer Slot ────────────────────────────────────────────────────────────── */
.viewer-slot {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  padding: 14px;
  min-height: 120px;
  position: relative;
}

.viewer-slot-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.viewer-slot-content {
  width: 100%;
}

.viewer-slot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.viewer-slot-error {
  color: var(--accent-red);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 8px 0;
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--panel-bg-heavy);
  border: 1px solid var(--border-color);
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
  width: 560px;
  max-width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-main);
}

/* ── Scrollbars ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* ── Focus States ───────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--hex-blue);
  outline-offset: 2px;
}
